package com.dzm.portal.listener;

import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.system.api.domain.Content;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 作者：Dzm
 * 时间：2024-09-10-11:52
 * 功能：
 */

@Component
//@RabbitListener(queues = "save-content")
public class SaveContentListener {
    @Autowired
    private RedisService redisService;

    @RabbitHandler
    public void save(Content content) {
        //存入缓存
        redisService.setCacheMapValue(CacheConstants.CONTENT_LIST, content.getId()+"", content);
    }
}
